import logging
import util
from efficient_apriori import apriori

logging.basicConfig(filename='../../log/apriori.log', encoding='utf-8', filemode='w',
                    level=logging.DEBUG, format='%(levelname)s: %(asctime)s %(message)s', datefmt='%I:%M:%S')

logging.info('Apriori Algorithm:\n')
minsup = 0.2
minconf = 0.4
# 使用Apriori算法进行规则挖掘
item_sets, rules = apriori(util.make_dataset(), minsup, minconf)
logging.info('item_sets: \n{}'.format(util.str_dict_iter(item_sets)))
logging.info('rules: \n{}'.format(util.str_iter(rules)))